/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cbsrs.view;

import com.cbsrs.controller.BlockDAO;
import com.cbsrs.controller.SubjectScheduleDAO;
import com.cbsrs.model.Blocks;
import com.cbsrs.model.CollegeSubjectOffering;
import com.cbsrs.model.SubjectSchedules;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Arnold
 */
public class SubjectOfferingAction extends ActionSupport {
    private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(SubjectOfferingAction.class);
    private List<SubjectSchedules> blockScheduleList;
    private List<CollegeSubjectOffering> collegeSubjectOfferingList;
    private List<Blocks> blockList;
    private String Id, subjectOfferingID;

    public String viewBlockSchedules() {
        try {
            log.info("ID :" + Id);
            blockScheduleList = SubjectScheduleDAO.findAll(Integer.parseInt(Id));
        } catch (Exception ex) {
            log.error(ex);
        }
        return SUCCESS;
    }

    public String viewSubjectOfferingBlocks() {
        try {
            log.info("subjectOfferingID :"+subjectOfferingID);
            if(subjectOfferingID != null){
                blockList = BlockDAO.find(Integer.parseInt(subjectOfferingID));
            }
        } catch (Exception ex) {
            log.error(ex);
        }
        return SUCCESS;
    }

    public String viewCollegeSubjectOffering() {

        collegeSubjectOfferingList = SubjectScheduleDAO.findAllCollegeSubjectOffering();
        return SUCCESS;
    }

    public List<CollegeSubjectOffering> getCollegeSubjectOfferingList() {
        return collegeSubjectOfferingList;
    }

    public void setCollegeSubjectOfferingList(List<CollegeSubjectOffering> collegeSubjectOfferingList) {
        this.collegeSubjectOfferingList = collegeSubjectOfferingList;
    }

    public List<Blocks> getBlockList() {
        return blockList;
    }

    public void setBlockList(List<Blocks> blockList) {
        this.blockList = blockList;
    }

    public String getId() {
        return Id;
    }

    public void setId(String Id) {
        this.Id = Id;
    }

    public String getSubjectOfferingID() {
        return subjectOfferingID;
    }

    public void setSubjectOfferingID(String subjectOfferingID) {
        this.subjectOfferingID = subjectOfferingID;
    }

    public List<SubjectSchedules> getBlockScheduleList() {
        return blockScheduleList;
    }

    public void setBlockScheduleList(List<SubjectSchedules> blockScheduleList) {
        this.blockScheduleList = blockScheduleList;
    }
}
